﻿IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[esf_files].[P_IncrementFileReferenceOpenCount]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [esf_files].P_IncrementFileReferenceOpenCount
GO


CREATE PROCEDURE esf_files.P_IncrementFileReferenceOpenCount
	@pLastOpenUserAlias VARCHAR (20),
	@pURL VARCHAR (MAX)
AS
	UPDATE 
		[esf_files].[FileReference] 
	SET 
		OpenCount = OpenCount + 1,
		LastOpenUserAlias = @pLastOpenUserAlias,
		LastOpenDateTime = GETDATE ()
	WHERE
		URL = @pURL